<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        body {
            background: url("https://img1.baidu.com/it/u=2374310259,3143032644&fm=253&fmt=auto&app=120&f=JPEG?w=889&h=500"), no-repeat center top;
        }
        
        .box {
            width: 430px;
            margin: 100px auto;
        }
        
        .box img {
            width: 100px;
            height: 60px;
        }
    </style>
</head>

<body>
    <div class="box">
        <img src="https://img1.baidu.com/it/u=2374310259,3143032644&fm=253&fmt=auto&app=120&f=JPEG?w=889&h=500" alt="">
        <img src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg3.bjd.com.cn%2F2021%2F08%2F22%2Fe8bca584a1dd721822f9e2cbc067642876910a2c.jpeg&refer=http%3A%2F%2Fimg3.bjd.com.cn&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1633949437&t=8d354e932c4fba5fdfd77f9c79b12350"
            alt="">
        <img src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fb1-q.mafengwo.net%2Fs18%2FM00%2F3A%2FFC%2FCoUBYGC7AAiAM_bFABrD6a6fiiQ271.jpg&refer=http%3A%2F%2Fb1-q.mafengwo.net&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1633949437&t=2fcb63300de7ce703554fc9c7676e970"
            alt="">
        <img src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fpic2.zhimg.com%2Fv2-3ef76b06d515e929bd32b23aa1a56f01_r.jpg&refer=http%3A%2F%2Fpic2.zhimg.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1633949494&t=da9dd8658e37be9cde25efc29951cb60"
            alt="">
    </div>
    <script>
        var imgs = document.querySelectorAll('img');
        for (var i = 0; i < imgs.length; i++) {
            imgs[i].onclick = function() {
                console.log(this.src); // 'this.src'
                document.body.style.backgroundImage = 'url(' + this.src + ')'
            }
        }
    </script>
</body>

</html>